﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Jzy.Model.Mail;
using Jzy.Model;
using Jzy.BLL.Mail;
using Frame.Lib.Utilities;
using Frame.Lib.Common;


public partial class Mail_Folder_Edit : PageEdit
{
    private int FolderType
    {
        get
        {
            return int.Parse(Request["FolderType"]);
        }
        
    }

    private string FolderID
    {
        get
        {
            return Request["ID"];
        }
    }

    private MailFolderBO _mailFolder;

    protected void Page_Load(object sender, EventArgs e)
    {
        _mailFolder = new MailFolderBO(AppSession.UserID,(MailFolderType)FolderType);
    }
  
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (_mailFolder.Exist(txtName.Text.Trim(), FolderID))
        {
            JSUtil.Alert("该目录已存在");
        }
        else
        {
            MailFolderInfo info = new MailFolderInfo();
            if (FolderID != null)
            {
                info.ID = int.Parse(FolderID);
            }
            info.Name = txtName.Text.Trim();
            info.TypeID = FolderType;
            info.UserID = AppSession.UserID;

            _mailFolder.Save(info);
            JSUtil.RefreshView();
        }
    }
}
